home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / proc / sun3.md / a.out.h < prev    next >
C/C++ Source or Header  |  1991-06-06  |  3KB  |  113 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)a.out.h    5.2 (Berkeley) 4/7/87
  7.  */
  8.  
  9. /*
  10.  * Definitions of the a.out header
  11.  * and magic numbers are shared with
  12.  * the kernel.
  13.  */
  14. #ifndef _AOUT
  15. #define _AOUT
  16.  
  17. #include <sun3.md/sys/exec.h>
  18.  
  19. extern int Aout_PageSize[];
  20.  
  21. /*
  22.  * Macro to tell whether or not the magic number in an a.out file
  23.  * is an illegal one.
  24.  */
  25.  
  26. #define    N_BADMAG(x) \
  27.     (((x).a_magic)!=OMAGIC && \
  28.      ((x).a_magic)!=NMAGIC && \
  29.      ((x).a_magic)!=ZMAGIC && \
  30.      ((x).a_magic)!=SPRITE_ZMAGIC && \
  31.      ((x).a_magic)!=UNIX_ZMAGIC)
  32.  
  33. /*
  34.  * Macros to tell where various pieces of information start in the
  35.  * a.out file.
  36.  */
  37.  
  38. #define N_PAGSIZ(x) (Aout_PageSize[(x).a_machtype])
  39.  
  40. #define N_TXTOFF(x) \
  41.     (((x).a_magic==ZMAGIC || (x).a_magic==UNIX_ZMAGIC) \
  42.         ? 0 : sizeof (struct exec))
  43. #define N_SYMOFF(x) \
  44.     (N_TXTOFF(x) + (x).a_text+(x).a_data + (x).a_trsize + (x).a_drsize)
  45. #define    N_STROFF(x) \
  46.     (N_SYMOFF(x) + (x).a_syms)
  47.  
  48. /*
  49.  * Macros to tell where the various segments start in virtual memory,
  50.  * when the process is loaded.
  51.  */
  52. #include <sun3.md/kernel/procMach.h>
  53.  
  54. #define N_TXTADDR(x) PROC_CODE_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  55. #define N_DATADDR(x) PROC_DATA_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  56. #define N_BSSADDR(x) PROC_BSS_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  57.  
  58. /*
  59.  * Format of a relocation datum.
  60.  */
  61. struct relocation_info {
  62.     int    r_address;    /* address which is relocated */
  63. unsigned int    r_symbolnum:24,    /* local symbol ordinal */
  64.         r_pcrel:1,     /* was relocated pc relative already */
  65.         r_length:2,    /* 0=byte, 1=word, 2=long */
  66.         r_extern:1,    /* does not include value of sym referenced */
  67.         :4;        /* nothing, yet */
  68. };
  69.  
  70. /*
  71.  * Format of a symbol table entry; this file is included by <a.out.h>
  72.  * and should be used if you aren't interested the a.out header
  73.  * or relocation information.
  74.  */
  75. struct    nlist {
  76.     union {
  77.         char    *n_name;    /* for use when in-core */
  78.         long    n_strx;        /* index into file string table */
  79.     } n_un;
  80. unsigned char    n_type;        /* type flag, i.e. N_TEXT etc; see below */
  81.     char    n_other;    /* unused */
  82.     short    n_desc;        /* see <stab.h> */
  83. unsigned long    n_value;    /* value of this symbol (or sdb offset) */
  84. };
  85. #define    n_hash    n_desc        /* used internally by ld */
  86.  
  87. /*
  88.  * Simple values for n_type.
  89.  */
  90. #define    N_UNDF    0x0        /* undefined */
  91. #define    N_ABS    0x2        /* absolute */
  92. #define    N_TEXT    0x4        /* text */
  93. #define    N_DATA    0x6        /* data */
  94. #define    N_BSS    0x8        /* bss */
  95. #define    N_COMM    0x12        /* common (internal to ld) */
  96. #define    N_FN    0x1e        /* file name symbol */
  97.  
  98. #define    N_EXT    01        /* external bit, or'ed in */
  99. #define    N_TYPE    0x1e        /* mask for all the type bits */
  100.  
  101. /*
  102.  * Sdb entries have some of the N_STAB bits set.
  103.  * These are given in <stab.h>
  104.  */
  105. #define    N_STAB    0xe0        /* if any of these bits set, a SDB entry */
  106.  
  107. /*
  108.  * Format for namelist values.
  109.  */
  110. #define    N_FORMAT    "%08x"
  111.  
  112. #endif /* _AOUT */
  113.